package model

import (
	"gorm.io/gorm"
)

type ModelContainerInstance struct {
	gorm.Model
	ModelInfoID uint   `gorm:"column:model_info_id;type:bigint;not null;uniqueIndex" json:"model_info_id"`
	ModelName   string `gorm:"column:model_name;type:varchar(255);not null;index" json:"model_name"`
	ContainerID string `gorm:"column:container_id;type:varchar(128);uniqueIndex" json:"container_id"`
	Image       string `gorm:"column:image;type:varchar(255)" json:"image"`
	Host        string `gorm:"column:host;type:varchar(45);not null;default:'127.0.0.1'" json:"host"`
	Port        int    `gorm:"column:port;not null;index" json:"port"`

	Status string `gorm:"column:status;type:varchar(20);not null;default:'pending';index" json:"status"`

	// 关联关系
	ModelInfo ModelInfo `gorm:"foreignKey:ModelInfoID" json:"model_info"`
}

func (ModelContainerInstance) TableName() string {
	return "model_container_instance"
}
